package com.springstudy.shiro.shiro.filters;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.web.servlet.OncePerRequestFilter;
import org.springframework.stereotype.Component;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

/**
 * OncePerRequestFilter 保证一次请求只调用一次 doFilterInternal
 *
 * @author chenrongrong
 * @since 2020/3/11 14:37
 */
@Slf4j
public class MyOncePerRequestFilter extends OncePerRequestFilter {
    @Override
    protected void doFilterInternal(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException {
        log.info("执行MyOncePerRequestFilter");
        filterChain.doFilter(servletRequest, servletResponse);
    }
}
